package dnl.jexem.watchdog.cli;

import java.io.File;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.OptionBuilder;

import dnl.infra.cli.CliSetting;

public class ConfigDirSetting extends CliSetting {

	private File configDir;

	public ConfigDirSetting() {
		OptionBuilder.withArgName("file");
		OptionBuilder.hasArg();
		OptionBuilder.isRequired();
		OptionBuilder.withDescription("configuration directory");
		addOption(OptionBuilder.create("configDir"));
	}

	@Override
	public void extractSetting(CommandLine cmd) {
		String value = cmd.getOptionValue("configDir");
		configDir = new File(value);
	}

	public File getConfigDir() {
		return configDir;
	}

}
